home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 120
/
Vol 120.iso
/
games
/
anacroz.swf
/
scripts
/
__Packages
/
Flecha.as
next >
Wrap
Text File
|
2010-11-09
|
2KB
|
37 lines
class Flecha
{
function Flecha(tilex0, tiley0, tilex1, tiley1, id, quem, mcnome, forca)
{
this.ativa = true;
var _loc5_ = (this.destinox = tilex1) - tilex0;
var _loc4_ = (this.destinoy = tiley1) - tiley0;
this.cz = -24;
this.fx = 40 * (_loc5_ + _loc4_) / (this.ft = Math.sqrt(_loc5_ * _loc5_ + _loc4_ * _loc4_) * 4);
this.fy = 20 * (tiley1 - tilex1 + tilex0 - tiley0) / this.ft;
this.t = (12 * this.ft - Math.sqrt(144 * this.ft * this.ft - 1152 * this.ft)) / 24;
this.id = id;
this.forca = forca;
this.quem = quem;
_root.attachMovie(mcnome,"f1" + id,3000 + id);
_root["f1" + id]._visible = false;
_root["f1" + id]._x = this.cx = 40 * (tilex0 + tiley0) - 240;
_root["f1" + id]._y = this.cy = 305 + (tiley0 - tilex0) * 20;
}
function atualizar()
{
this.cz = this.forca * ((- this.ft) * this.t + this.t * this.t) / this.ft;
if(this.cz > 0)
{
this.ativa = false;
_root.flechadano(this.id,this.destinox,this.destinoy,this.quem);
removeMovieClip(_root["f1" + this.id]);
return undefined;
}
_root["f1" + this.id]._rotation = 180 * Math.atan2(this.fy + this.forca * (2 * this.t + 1 - this.ft) / this.ft,this.fx) / 3.141592653589793;
_root["f1" + this.id]._x = this.cx += this.fx;
_root["f1" + this.id]._y = (this.cy += this.fy) + this.cz;
_root["f1" + this.id]._visible = true;
this.t = this.t + 1;
}
}